/*
 * Unit test for function cardEffect testing village card in dominion.c
 *
 * cardtest1: cardtest1.c dominion.o rngs.o
 *     gcc -o cardtest1 -g  cardtest1.c dominion.o rngs.o $(CFLAGS)
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

int main() {
    int seed = 1000;
    int numPlayer = 2;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;

    printf ("TESTING village card cardEffect():\n");
    memset(&G, 23, sizeof(struct gameState));   // clear the game state
    initializeGame(numPlayer, k, seed, &G); // initialize a new game

    int card = village;
    int choice1 = 0; //doesn't affect card
    int choice2 = 0; //doesn't affect card
    int choice3 = 0; //doesn't affect card
    int handPos = 0; //position of card in hand array, only testing one card
    int bonus = 0;

    int initialNumActions = G.numActions;
    int initialHandCount = G.handCount[0];

    int check = cardEffect(card, choice1, choice2, choice3, &G, handPos, &bonus);
    assert(check == 0);
    // villages adds 2 actions and 1 card; check state->numActions and state->handCount
    //int afterNumActions = G.numActions;
    //int afterHandCount = G.handCount[0];
    assert(G.numActions == initialNumActions+2);
    assert(G.handCount[0] == initialHandCount+1-1);//add card to hand, discard village card from hand
    printf("All tests passed!\n");

    return 0;
}
